var WebDeveloper = WebDeveloper || {};

WebDeveloper.Content = WebDeveloper.Content || {};

// Returns all the documents under a frame
WebDeveloper.Content.getDocuments = function(frame)
{
  var documents = [];

  // If the frame is set
  if(frame)
  {
    var frames = frame.frames;

    // If the frame document exists
    if(frame.document)
    {
      documents.push(frame.document);
    }

    // Loop through the frames
    for(var i = 0, l = frames.length; i < l; i++)
    {
      documents = documents.concat(WebDeveloper.Content.getDocuments(frames[i]));
    }
  }

  return documents;
};


/*
//THIS FUNCTION HAS ONLY BEEN ADDED TO ALLOW THE TURNING BACK ON OF IMAGES
// Returns any images in the document
WebDeveloper.Content.getImages = function()
{
  var allImages        = null;
  var contentDocument  = WebDeveloper.Common.getContentDocument();
  var contentDocuments = WebDeveloper.Content.getDocuments(WebDeveloper.Common.getContentWindow());
  var documentImage    = null;
  var documentImages   = null;
  var image            = null;
  var images           = {};

  images.documents = [];
  images.pageTitle = contentDocument.title;
  images.pageURL   = contentDocument.documentURI;

  // Loop through the documents
  for(var i = 0, l = contentDocuments.length; i < l; i++)
  {
    contentDocument       = contentDocuments[i];
    allImages             = WebDeveloper.Common.getDocumentImages(contentDocument);
    documentImages        = {};
    documentImages.images = [];
    documentImages.url    = contentDocument.documentURI;

    // Loop through the images
    for(var j = 0, m = allImages.length; j < m; j++)
    {
      documentImage = {};
      image         = allImages[j];

      // If the image has an alt attribute
      if(image.hasAttribute("alt"))
      {
        documentImage.alt = image.getAttribute("alt");
      }

      documentImage.height = image.naturalHeight;
      documentImage.src    = image.src;
      documentImage.width  = image.naturalWidth;

      documentImages.images.push(documentImage);
    }

    images.documents.push(documentImages);
  }

  return images;
};
//THIS FUNCTION HAS ONLY BEEN ADDED TO ALLOW THE TURNING BACK ON OF IMAGES
*/
